package com.seesman.application.maintenance.gui.certificate;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Map;

import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import com.seesman.application.maintenance.common.gui.utilities.FrameDetailsUtil;
import com.seesman.application.maintenance.common.gui.utilities.WindowUtilities;
import com.seesman.application.maintenance.common.gui.utilities.FrameDetailsUtil.CertificateLabel;

public class CertificateFrame extends JInternalFrame implements ActionListener {
	
	private static final long serialVersionUID = 407054709212646727L;
	
	public JLabel lblCertID;
	public JLabel lblCertName;
	public JLabel lblStatus;	
	public JTextField txtCertID;
	public JTextField txtCertName;
	public JTextField txtStatus;
	
	public CertificateFrame() {
		WindowUtilities.setNativeLookAndFeel();
		
		FrameDetailsUtil details = new FrameDetailsUtil();
		Map<CertificateLabel, String> map = details.getMapCertificateLabel();
					
		lblCertID = new JLabel(map.get(CertificateLabel.CERTIFICATE_ID));
		lblCertID.setLabelFor(txtCertID);
		txtCertID = new JTextField(null, 20);
		
		lblCertName = new JLabel(map.get(CertificateLabel.CERTIFICATE_NAME));
		lblCertName.setLabelFor(txtCertName);
		txtCertName = new JTextField(null, 20);
		
		lblStatus = new JLabel(map.get(CertificateLabel.STATUS));
		lblStatus.setLabelFor(txtStatus);		
		txtStatus = new JTextField(null, 20);
		
		JPanel labelPanel = new JPanel(new GridLayout(map.size(), 1));
		add(labelPanel, BorderLayout.WEST);
		labelPanel.add(lblCertID);
		labelPanel.add(lblCertName);
		labelPanel.add(lblStatus);
		
		JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
		panel.add(lblCertID, BorderLayout.WEST);
		panel.add(lblCertName, BorderLayout.WEST);
		panel.add(lblStatus, BorderLayout.WEST);
		panel.add(txtCertID, BorderLayout.CENTER);
		panel.add(txtCertName, BorderLayout.CENTER);
		panel.add(txtStatus, BorderLayout.CENTER);
		
		getContentPane().add(panel, BorderLayout.CENTER);		
		pack();		
		setSize(300, 130);
		setTitle("Certificate");
		setVisible(true);
		setMaximizable(true);
		setResizable(false);
		setClosable(true);
		
	}

	public void actionPerformed(ActionEvent event) {
		
		
	}
	
}
